package com.gitee.wsl.common.struct.quadtree

/**
 * Todo this is really representing a rectangle. Is there a reason to name it Extent.
 * Todo make it immutable (data class)
 */
 class Extent(
     var x0: Float,  var y0: Float,
     var x1: Float,  var y1: Float)
{
     constructor(
          x0: Double,   y0: Double,
          x1: Double,   y1: Double
     ):this(x0.toFloat(),y0.toFloat(),x1.toFloat(),y1.toFloat())

     var width: Float
        get() = x1 - x0

        set(value) {
            x0 = .0f
            x1 = value
        }

     var height: Float
        get() = y1 - y0
        set(value) {
            y0 = .0f
            y1 = value
        }

     fun copy(): Extent {
        return Extent(x0, y0, x1, y1)
    }
}
